<extend name="Public/base"/>
<block name="body">
    <div class="portlet box blue">
        <div class="portlet-title">
            <div class="caption"><i class="fa fa-reorder"></i>考试</div>
            <div class="tools">
                <a href="javascript:;" class="collapse"></a>
                <a href="#portlet-config" data-toggle="modal" class="config"></a>
            </div>
        </div>
        <div class="portlet-body">
            <div class="tabbable-custom">
                <ul class="nav nav-tabs ">
                    <li class="active"><a href="#tab_1" data-toggle="tab">考试难度</a></li>
                    <li><a href="#tab_2" data-toggle="tab">考试类别</a></li>
                </ul>

                <div class="tab-content" style="padding: 10px 0 0 0;">
                    <div class="tab-pane active" id="tab_1">

                        <form class="form-horizontal form-nandu" action="{:U('User/examsetting?type_id=1')}" method="post">

                            <volist name="_list1" id="vs" key="k">
                                   <div class="form-group col-md-12">
                                       <label class="control-label col-md-2">难度级别</label>
                                       <div class="col-md-4">
                                           <input type="text" name="cate_name[]" value="{$vs.cate_name}" class="form-control" placeholder="请输入难度级别"/>
                                       </div>
                                       <input type="hidden" name="cid[]" value="{$vs.cid}"/>
                                       <div class="col-md-1" id="addbtn">
                                           <if condition="$k eq 1">
                                               <i style="cursor: pointer" class="fa fa-plus-square text-success margin-top-10"></i>
                                               <else/>
                                               <a href="{:U('User/cateDel?cid='.$vs[cid])}" class="ajax-get confirm fa fa-minus-square text-danger margin-top-10"></a>
                                           </if>

                                       </div>
                                   </div>


                            </volist>
                            <div id="levelbox">

                                <!--在此div中添加难度选项-->
                            </div>

                            <div class="clearfix"></div>
                            <div class="form-actions fluid">
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="col-md-offset-3 col-md-6">
                                            <button type="submit" target-form="form-nandu" class="ajax-post btn green">确定</button>
                                            <button type="button" class="btn default">返回</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="tab-pane" id="tab_2">
                        <form class="form-horizontal form-cate" action="{:U('User/examsetting?type_id=2')}" method="post">
                            <volist name="_list2" id="vs" key="key">
                            <div class="form-group col-md-12">
                                <label class="control-label col-md-2">考试类别</label>
                                <div class="col-md-4">
                                    <input type="text" value="{$vs.cate_name}" class="form-control"name="cate_name[]" placeholder="请输入考试类别"/>
                                </div>
                                <input type="hidden" name="cid[]" value="{$vs.cid}"/>
                                <div class="col-md-1" id="addlei">
                                    <if  condition= "$key eq 1">
                                        <i style="cursor: pointer" class="fa fa-plus-square text-success margin-top-10"></i>
                                        <else/>
                                        <a href="{:U('User/cateDel?cid='.$vs[cid])}" class="ajax-get confirm fa fa-minus-square text-danger margin-top-10"></a>
                                    </if>

                                </div>

                            </div>

                           </volist>

                            <div id="leibox">
                                <!--在此div中添加类别选项-->
                            </div>

                            <div class="clearfix"></div>
                            <div class="form-actions fluid">
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="col-md-offset-3 col-md-6">
                                            <button type="submit" target-form="form-cate" class="ajax-post btn green">确定</button>
                                            <button type="button" class="btn default">返回</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="cutbox" style="display: none;">
        <div class="form-group col-md-12 cutlevel">
            <label class="control-label col-md-2">难度级别</label>
            <div class="col-md-4">
                <input type="text" class="form-control" name="cate_name[]" placeholder="请输入难度级别"/>
            </div>
            <div class="col-md-1 cutbtn">
                <i style="cursor: pointer" class="fa fa-minus-square text-danger margin-top-10"></i>
            </div>
        </div>
    </div>

    <div class="leibox" style="display: none;">
        <div class="form-group col-md-12 cutlevel">
            <label class="control-label col-md-2">考试类别</label>
            <div class="col-md-4">
                <input type="text" class="form-control" name="cate_name[]" placeholder="请输入考试类别"/>
            </div>
            <div class="col-md-1 cutbtn">
                <i style="cursor: pointer" class="fa fa-minus-square text-danger margin-top-10"></i>
            </div>
        </div>
    </div>
</block>
<block name="script">
    <script src="__STATIC__/scripts/app.js"></script>
    <script>
        jQuery(document).ready(function() {
            App.init();
            var leibox=$('.leibox').html();
            $('#addlei').click(function(){ //添加难易选项
                $('#leibox').append(leibox);
            });
            var cutbox=$('.cutbox').html();
            $('#addbtn').click(function(){ //添加难易选项
                $('#levelbox').append(cutbox);
            });
            $("body").on('click','.cutbtn',function(){ //删除难易选项
                $(this).parents('.cutlevel').remove();
            });
        });

    </script>
</block>



